package abacab.remote.oio;

import java.io.IOException;
import java.net.ConnectException;

import abacab.remote.Connection;
import abacab.remote.ConnectionRegistry;
import abacab.remote.protocol.Acceptor;
import abacab.remote.protocol.ImplementationFactory;

/**
 * An implementation using sockets
 */
public class SocketImplementation implements ImplementationFactory {
	@Override
	public Acceptor buildAcceptor(ConnectionRegistry registry) throws IOException {
		return new SocketAcceptor(registry);
	}

	@Override
	public Connection buildClient(ConnectionRegistry connectionRegistry, String hostname, int port)
			throws ConnectException {
		return new SocketClient(connectionRegistry, hostname, port);
	}
}